package com.dyz.leetcode._06_binarySearch;

public class _240_searchMatrix {
    public boolean searchMatrix(int[][] matrix, int target) {
        int m = matrix.length;
        int n = matrix[0].length;
        int left = m-1;
        int right = 0;
        while(left>=0 && right<n){
            if(matrix[left][right]==target){return true;}
            else if(matrix[left][right]>target){
                left--;
            }else{
                right++;
            }
        }
        return false;
    }
}
